//
//  BAWeatherViewModel.swift
//  BadAir
//
//  Created by D on 2018/4/9.
//  Copyright © 2018年 D. All rights reserved.
//

import UIKit

class BAWeatherViewModel: NSObject {
    
    class func weatherCodeToIcon(code: String) -> UIImage {
        
        let weatherCode: CGFloat = String().stringToFloat(code)!
        var image = #imageLiteral(resourceName: "icon_weather_ri")
        
        switch weatherCode {
        case 0...103:
            image = #imageLiteral(resourceName: "icon_weather_ri")
        case 104:
            image = #imageLiteral(resourceName: "icon_weather_yun")
        case 200...213:
            image = #imageLiteral(resourceName: "icon_weather_feng")
        case 300...313:
            image = #imageLiteral(resourceName: "icon_weather_yu")
        case 400...407:
            image = #imageLiteral(resourceName: "icon_weather_xue")
        case 500...502:
            image = #imageLiteral(resourceName: "icon_weather_mai")
        case 503...508:
            image = #imageLiteral(resourceName: "icon_weather_sa")
        case 900...:
            image = #imageLiteral(resourceName: "icon_weather_ri")
        default: break
        }
        
        return image
        
    }
}
